﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _025类的继承和类的成员访问控制_1
{
    internal class Program
    {
        static void Main(string[] args)
        {

            Car car = new Car();
            Vehicle vehicle = new Vehicle();
            Console.WriteLine(car is Vehicle);//True 
            Console.WriteLine(car is Object);//True
            Console.WriteLine(vehicle is Car);//False

            //父类类型实例引用子类型的实例
            Vehicle vehicle1 = new Car();
            Object obj1 = new Vehicle();
            Object obj2 = new Car();
        }
    }

    //C#中继承链顶端都是Object 都是显示或隐式的派生
    sealed class Vehicle
    {

    }

    //类的派生
    class Car : Vehicle
    {

    }
}
